{% extends "base.html" %}

{% macro dir_list(title,list) %}
    <h1>{{ title }}</h1>
    <h3>文章列表</h3>
    <table class="table">
    {% for it in list %}
    <tr>
    <td><a href=".{% if not is_archives %}.{% endif %}/post/{{it['url']}}.html" >{{it['title']}}</a></td>
    </tr>
    {% endfor %}
    </table>
{% endmacro %}
{% macro dir_tags_list(title, tags) %}
<h1>{{title}}</h1>
<h3>标签列表</h3>
<table class="table">
    {% for it in tags %}
    <tr>
        <td><a href="./tags/{{it}}.html">{{it}}</a></td>
    </tr>
    {% endfor %}
</table>
{% endmacro %}

{% block this_title %}{{ title }}-List{% endblock %}

{% block script %}
{% if not is_archives %}
<link href="../source/css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="../source/css/github.css" rel="stylesheet" type="text/css">
<link href="../source/css/oub.css" rel="stylesheet" type="text/css">
<script src="../source/js/highlight.pack.js" ></script>
<script src="../source/js/jquery-3.3.1.min.js"></script>
<script src="../source/js/popper.min.js"></script>
<script src="../source/js/bootstrap.js" type="text/javascript"></script>
{% else %}
<link href="./source/css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="./source/css/github.css" rel="stylesheet" type="text/css">
<link href="./source/css/oub.css" rel="stylesheet" type="text/css">
<script src="./source/js/highlight.pack.js" ></script>
<script src="./source/js/jquery-3.3.1.min.js"></script>
<script src="./source/js/popper.min.js"></script>
<script src="./source/js/bootstrap.js" type="text/javascript"></script>
{% endif %}
{% endblock %}

{% block content %}
{% if is_archives==1 %}
    {{ dir_list(title, posts) }}
{% elif is_archives==0 %}
    {{ dir_list(title, posts)}}
{% elif is_archives==2 %}
    {{ dir_tags_list(title, tags)}}
{% endif %}
{% endblock %}

{% block links %}{{ link|safe }}{% endblock %}

{% block photo %}
<img class="rounded-lg" src="{% if not is_archives %}.{% endif %}./source/picture/photo.jpg" width="100%" />
{% endblock %}
{% block nav %}
<li class="nav-item active"> <a class="nav-link" href=".{% if not is_archives %}.{% endif %}/index.html">Home</a> </li>
<li class="nav-item active"> <a class="nav-link" href=".{% if not is_archives %}.{% endif %}/archives.html">Archives</a> </li>
<li class="nav-item active"> <a class="nav-link" href=".{% if not is_archives %}.{% endif %}/tags.html">Tags</a> </li>
{% endblock %}